/********************************************************************************************************
/*
/*    tPt.h
/*
/********************************************************************************************************/

#pragma once

#include <windows.h>

//=======================================================================================================
// CLASS PT (POINT)
//=======================================================================================================
template<class C> class tPt
{

public:

	tPt () {;}
	tPt ( const tPt<C> & old );
	tPt ( C x, C y );
	tPt ( POINT & rh );

	~tPt () {;};

	tPt<C> & operator= ( const tPt<C>  & old );
	tPt<C> & operator+= ( const tPt<C>  & old );
	tPt<C> & operator-= ( const tPt<C>  & old );
	tPt<C> & operator*= (const C &rh );
	tPt<C> & operator/= (const C &rh );
	bool     operator== (const tPt<C> & rh );

	C x;
	C y;
};


typedef tPt<int>    cPtI;
typedef tPt<double> cPtD;
typedef tPt<float>  cPtF;

//=======================================================================================================
// CODE
//=======================================================================================================

//-------------------------------------------------------------------------------------------------------
// OPERATOR ==
//-------------------------------------------------------------------------------------------------------
template<class C> bool tPt<C>::operator== ( const tPt<C> & rh )
{
	if ( x == rh.x && y == rh.y )
		return true;
	else
		return false;

}


//-------------------------------------------------------------------------------------------------------
//  CONSTRUCTOR
//-------------------------------------------------------------------------------------------------------
template<class C> tPt<C>::tPt ( POINT & rh )
{
	x = rh.x;
	y = rh.y;
}
template<class C> tPt<C>::tPt ( const tPt<C> & rh )
{
	x = rh.x;
	y = rh.y;
}
template<class C> tPt<C>::tPt ( C rh_x, C rh_y )
{
	x = rh_x;
	y = rh_y;
}

//-------------------------------------------------------------------------------------------------------
//  OPERATOR=
//-------------------------------------------------------------------------------------------------------
template<class C> tPt<C> & tPt<C>::operator= ( const tPt<C>  & rh )
{
	x = rh.x;
	y = rh.y;

	return *this;
}


//-------------------------------------------------------------------------------------------------------
// OPERATOR *=
//-------------------------------------------------------------------------------------------------------
template<class C> tPt<C> & tPt<C>::operator*= ( const C & rh )
{
	x *= rh;
	y *= rh;

	return *this;
}


//-------------------------------------------------------------------------------------------------------
// OPERATOR /=
//-------------------------------------------------------------------------------------------------------
template<class C> tPt<C> & tPt<C>::operator/= ( const C & rh )
{
	x /= rh;
	y /= rh;

	return *this;
}


//-------------------------------------------------------------------------------------------------------
// OPERATOR +=
//-------------------------------------------------------------------------------------------------------
template<class C> tPt<C> & tPt<C>::operator+= ( const tPt<C> & rh )
{
	x += rh.x;
	y += rh.y;

	return *this;
}


//-------------------------------------------------------------------------------------------------------
// OPERATOR -=
//-------------------------------------------------------------------------------------------------------
template<class C> tPt<C> & tPt<C>::operator-= ( const tPt<C> & rh )
{
	x -= rh.x;
	y -= rh.y;

	return *this;
}



